package com.huawei;

/**
 * Created by Z-hong on 2024/7/25.
 */
import java.util.*;
public class HJ103_dp {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int count=sc.nextInt();
        int arr[]=new int[count];
        for (int i = 0; i < count; i++) {
            arr[i]=sc.nextInt();
        }
        int dp[]=new int[count];
        Arrays.fill(dp,1);
        int max = 1;
        for(int i = 1;i < arr.length;++i){
            for(int j = 0;j < i;++j){
                if(arr[j] < arr[i]){
                    dp[i] = Math.max(dp[i],dp[j] + 1);
                }
                max = Math.max(dp[i],max);
            }
        }
        System.out.println(max);
    }
}
